﻿using OnDash.Mathematics.Vector;
using OnDash.Windowing.Common;
using OnDash.Windowing.Common.Enums;
using OnDash.Windowing.Common.Inputs;
using OnDash.Windowing.GraphicsLibraryFramework;

namespace OnDash.Windowing.Desktop;

public struct NativeWindowSettings
{
    public static readonly NativeWindowSettings Default = new NativeWindowSettings();

    public unsafe NativeWindowSettings()
    {
        GlfwProvider.EnsureInitialized();
        CurrentMonitor = new MonitorHandle((IntPtr)Glfw.GetPrimaryMonitor());
    }

    public IGlfwGraphicsContext SharedContext { get; set; }

    public WindowIcon Icon { get; set; }

    public bool IsEventDriven { get; set; } = false;

    public ContextApi Api { get; set; } = ContextApi.OpenGl;

    public ContextProfile Profile { get; set; } = ContextProfile.Core;

    public ContextFlags Flags { get; set; } = ContextFlags.Default;

    public bool AutoLoadBindings { get; set; } = true;

    public Version ApiVersion { get; set; } = new(3, 3);

    public MonitorHandle CurrentMonitor { get; set; }

    public string Title { get; set; } = "OpenTK Window";

    public bool StartFocused { get; set; } = true;

    public bool StartVisible { get; set; } = true;

    public WindowState WindowState { get; set; } = WindowState.Normal;

    public WindowBorder WindowBorder { get; set; } = WindowBorder.Resizable;

    public Vector2? Location { get; set; }

    public Vector2 Size { get; set; } = new(640, 360);

    public Vector2? MinimumSize { get; set; } = null;

    public Vector2? MaximumSize { get; set; } = null;

    public (int numerator, int denominator)? AspectRatio { get; set; } = null;

    [Obsolete("Use WindowState instead.", true)]
    public bool IsFullscreen { get; set; } = false;

    public int NumberOfSamples { get; set; }

    public int? StencilBits { get; set; }

    public int? DepthBits { get; set; }

    public int? RedBits { get; set; }

    public int? GreenBits { get; set; }

    public int? BlueBits { get; set; }

    public int? AlphaBits { get; set; }

    public bool SrgbCapable { get; set; }
}